//#define __DEBUG__
// by Xeno
#define THIS_FILE "fn_getranpointsquareold.sqf"
#include "x_setup.sqf"

// no slope check, for patrolling
private ["_pos", "_a", "_b", "_angle", "_centerx", "_centery", "_leftx", "_lefty", "_width", "_height", "_ret_val", "_co", "_px1", "_py1", "_radius", "_atan", "_x1", "_y1"];
PARAMS_4(_pos,_a,_b,_angle);
_centerx = _pos select 0;_centery = _pos select 1;_leftx = _centerx - _a;_lefty = _centery - _b;
_width = 2 * _a;_height = 2 * _b;_ret_val = [];
for "_co" from 0 to 99 do {
	_px1 = _leftx + random _width; _py1 = _lefty + random _height;
	_radius = _pos distance [_px1,_py1];
	_atan = (_centerx - _px1) atan2 (_centery - _py1);
	_x1 = _centerx - (_radius * sin (_atan + _angle));
	_y1 = _centery - (_radius * cos (_atan + _angle));
	if !(surfaceiswater [_x1, _y1]) exitWith {_ret_val = [_x1, _y1, 0]};
};
_ret_val